# _*_ coding: utf-8 _*_
from odoo import models,fields,api


class OrderPriorityMixin(models.AbstractModel):
    _name = "order.priority.mixin"

    sequence = fields.Integer(string="Sequence", default=100)
    emergent = fields.Boolean(string="Emergent", default=False)
    not_emergent = fields.Boolean(string='Not Emergent', default=True)

    @api.multi
    def toggle_emergent(self):
        for record in self:
            record.emergent = not record.emergent
            record.not_emergent = not record.emergent
            if record.emergent:
                record.sequence = 1
            else:
                record.sequence = 100
